<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>权限管理 - 帐户管理</title>

    <#include "/pages/include/head.ftl" />
	<#import "/pages/import/images.ftl" as img />
    
    <style type="text/css">
      .tree-left-height{height:510px;}
      .error-message{color:red;font-family: "宋体", Arial, Verdana;font-size: 15px;}
   </style>
</head>

<body>
<#assign contextPath = request.contextPath/>
<div class="page-top-bar">
<ul class="path">帐号管理<span>&gt;</span>新建帐号</ul>
<ul class="page-control"><li><a href="javascript:void(0)" onfocus="this.blur()"><img src="${contextPath}/images/ico16/ico-back.gif" alt="" /><span onclick="page('list.action')">返回</span></a></li></ul>
<ul class="page-control"></ul>
</div>
<div class="function-bar">
<ul class="business-info"></ul>
<ul class="form-function">
</ul>
</div>

<div class="form-container">
<div class="form-title"><span class="form-title-into">新建账号</span></div>
<div id="errormessage" class="error-message">
<@s.fielderror />
<@s.actionerror/>
<@s.actionmessage/>
</div>
<@s.property value="exception.message"/>
<ul id="formerrors" class="errorMessage"></ul> 
<@s.url var="createurl" action="create" namespace="/account" />
<@s.form id="saveform" theme="css_xhtml" action="${createurl}">
<table cellspacing="1" cellpadding="0" class="form-2column form-margin">
    <tr>
      <th>帐户名称：</th>
      <td class="from-require"><input type="text" name="account.username" class="input-common input-word-10" />
（只能使用字母、数字、下划线、中划线、"@"和"."）</td>
    </tr>
    <tr>
      <th><label for="commonityNumber">帐户密码：</label></th>
      <td class="from-require"><input type="password" name="account.password" class="input-common input-word-10" />
（ 密码无限制 ，密码最小长度为6位 ）</td>
    </tr>
    <tr>
      <th>再次输入密码：</th>
      <td class="from-require">
        <input type="password" name="passwordConfirm" class="input-common input-word-10" /></td>
    </tr>
    <tr>
      <th><label for="label">用户真实姓名：</label></th>
      <td class="from-require"> 
       <input type="text" name="account.realName" class="input-common input-word-10" /></td>
    </tr>
    <tr>
      <th><label for="label">电子邮件：</label></th>
      <td class="from-require"> 
       <input type="text" name="account.email" class="input-common input-word-10" /></td>
    </tr>
    <tr>
      <th>备注：</th>
      <td><textarea name="account.description" cols="50" rows="5"></textarea></td>
    </tr>   
  </table> 
  </@s.form>  
<div class="form-title"></div>
<div class="main-form-btn">
     <div class="btn-order" onclick="postdata();">
        <ul>
          <li class="left-normal" id="btn1_11"></li>
          <li class="middle-normal" id="btn1_12" onmouseover="btn_change_over(1)" onmouseout="btn_change_out(1)" onblur="btn_change(1)"><img src="${contextPath}/images/ico16/ico-save.gif" alt="" />保 存</li>
          <li class="right-normal" id="btn1_13"></li>
       </ul>
      </div>
      <div class="btn-order" onclick="page('list.action')">
        <ul>
          <li class="left-normal" id="btn1_31"></li>
          <li class="middle-normal" id="btn1_32" onmouseover="btn_change_over(3)" onmouseout="btn_change_out(3)" onblur="btn_change(3)"><img src="${contextPath}/images/ico16/ico-back.gif" alt="" />返 回</li>
          <li class="right-normal" id="btn1_33"></li>
       </ul>
      </div>
</div>
</div>
</body>
<@s.url var="url" action="account-create" namespace="/account" />
<script type="text/javascript">
function postdata(){
   if($('input[name="account.password"]').val()!=$('input[name="passwordConfirm"]').val()){
      alert("两次密码不一致");
      return;
    }
    $('#saveform').submit();
}

function page(url){
	window.open(url,"main","");
}

$(function(){
   $("#saveform").submit(function(){
			validate();
			return false;
   });
   
   function validate(){
    $.ajax({
				url: "${url}",
				type: "POST",
				data: $("#saveform").serialize() + '&struts.enableJSONValidation=true&struts.validateOnly=true',
				complete: function(data, textStatus){
					var text = data.responseText;
					var errorsObject = StrutsUtils.getValidationErrors(text);
				     //show errors, if any
				     if(errorsObject && errorsObject.fieldErrors) {
				        StrutsUtils.showValidationErrors(document.getElementById("saveform"), errorsObject);
				     } else {
				       page('list.action');
				     }
				 }
			});
   }
});
</script>

</html>

